package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try{
//            String a = null;
//            System.out.println(a);
//            System.out.println(a.length());
            String b = "abc";
//            System.out.println(b);
//            System.out.println(b.charAt(5));

            System.out.println(Integer.parseInt(b));

        }catch (NullPointerException e){
            System.out.println("空指针异常处理了");

        }catch (StringIndexOutOfBoundsException e){
            System.out.println("下标越界处理了");
        }catch (NumberFormatException e){
            System.out.println("格式错误处理了");
        }



        System.out.println("程序结束了");

    }
}
